using UnityEngine;
using System.Collections;

public class SkipScreen : MonoBehaviour 
{
	public string sceneName;
	public float amount;
	
	void Awake()
	{
		gameObject.AddComponent("SceneChange");
		gameObject.AddComponent("FadeIn");
		gameObject.GetComponent<FadeIn>().createFade(amount);
	}
	
	IEnumerator run()
	{
		while(true)
		{
			if(Input.anyKey)
			{
				if(gameObject.GetComponent<SceneChange>().existFade())
				{
					gameObject.GetComponent<SceneChange>().createFade(sceneName,amount);
				}
			}
			
            yield return null;
		}
	}
	
	IEnumerator Start()
	{
		yield return new WaitForSeconds(3);
		StartCoroutine(run());
	}
	
}
